home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-ALPH.{_4 / STRING.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  64 lines

  1. #ifndef __ALPHA_STRING_H__
  2. #define __ALPHA_STRING_H__
  3.  
  4. #ifdef __KERNEL__
  5.  
  6. /*
  7.  * GCC of any recent vintage doesn't do stupid things with bcopy.
  8.  * EGCS 1.1 knows all about expanding memcpy inline, others don't.
  9.  *
  10.  * Similarly for a memset with data = 0.
  11.  */
  12.  
  13. #define __HAVE_ARCH_MEMCPY
  14. /* For backward compatibility with modules.  Unused otherwise.  */
  15. extern void * __memcpy(void *, const void *, size_t);
  16.  
  17. #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
  18. #define memcpy __builtin_memcpy
  19. #endif
  20.  
  21. #define __HAVE_ARCH_MEMSET
  22. extern void * __constant_c_memset(void *, unsigned long, size_t);
  23. extern void * __memset(void *, int, size_t);
  24.  
  25. #if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
  26. #define memset(s, c, n)                                \
  27. (__builtin_constant_p(c)                            \
  28.  ? (__builtin_constant_p(n) && (c) == 0                        \
  29.     ? __builtin_memset((s),0,(n))                         \
  30.     : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
  31.  : __memset((s),(c),(n)))
  32. #else
  33. #define memset(s, c, n)                            \
  34. (__builtin_constant_p(c)                        \
  35.  ? __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n)) \
  36.  : __memset((s),(c),(n)))
  37. #endif
  38.  
  39. #define __HAVE_ARCH_STRCPY
  40. #define __HAVE_ARCH_STRNCPY
  41. #define __HAVE_ARCH_STRCAT
  42. #define __HAVE_ARCH_STRNCAT
  43. #define __HAVE_ARCH_STRCHR
  44. #define __HAVE_ARCH_STRRCHR
  45. #define __HAVE_ARCH_STRLEN
  46.  
  47. /* The following routine is like memset except that it writes 16-bit
  48.    aligned values.  The DEST and COUNT parameters must be even for 
  49.    correct operation.  */
  50.  
  51. #define __HAVE_ARCH_MEMSETW
  52. extern void * __memsetw(void *dest, unsigned short, size_t count);
  53.  
  54. #define memsetw(s, c, n)                         \
  55. (__builtin_constant_p(c)                         \
  56.  ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
  57.  : __memsetw((s),(c),(n)))
  58.  
  59. extern int strcasecmp(const char *, const char *);
  60.  
  61. #endif /* __KERNEL__ */
  62.  
  63. #endif /* __ALPHA_STRING_H__ */
  64.